package com.zzit.vjv.controller.documentReview_controller.developer;

import com.zzit.vjv.biz.documentReview_biz.developer.DevLoginBiz;
import com.zzit.vjv.entity.documentReview_entity.DevUser;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

/**
 * 前台登录控制器
 */
@Controller("devLoginController")
@RequestMapping("dev")
public class DevLoginController {

    @Resource(name = "devLoginBiz")
    private DevLoginBiz devLoginBiz;

    /**
     * 登录方法
     * @return
     */
    @RequestMapping("/loing")
    public String devLoing(Model model, HttpSession httpSession, DevUser devUser){


        System.out.println(devUser);

        DevUser devUser1=devLoginBiz.findDevUserByDevCodeAndDevPassword(devUser);

        if(devUser1!=null){

            httpSession.setAttribute("devUserSession",devUser1);

            return "jsp/developer/main";
        }


        model.addAttribute("error","用户名或密码错误");



        return "jsp/devlogin";
    }







}
